package com.alexrnl.BetaSeriesFileManager.API.entities.enums;

import com.alexrnl.BetaSeriesFileManager.API.entities.Show;

/**
 * Enumeration representing the status of a {@link Show}, i.e. if the show has {@link #ENDED
 * ended}, is {@link #ON_HIATUS on hiatus} or if it is still {@link #CONTINUING on going}.
 * 
 * @author Alex
 */
public enum StatusShow {
	/**
	 * The show has ended.
	 */
	ENDED ("Ended"),

	/**
	 * The show is on going.
	 */
	CONTINUING ("Continuing"),

	/**
	 * The show is on hiatus.
	 */
	ON_HIATUS ("On Hiatus"),

	/**
	 * The status is unknown (most likely, the field is blank on thetvdb.com).
	 */
	OTHER ("");

	private String	name;

	/**
	 * Constructor.
	 * @param name
	 *            the name of the status for the show
	 */
	private StatusShow (final String name) {
		this.name = name;
	}

	/**
	 * @return the name of the status.
	 */
	public String getName () {
		return name;
	}

	/**
	 * Retrieve a {@link StatusShow} using the name of the status.
	 * @param name
	 *            the name to look for.
	 * @return the matching enumeration, if it exist
	 */
	public static StatusShow fromName (final String name) {
		return Enum.valueOf(StatusShow.class, name);
	}
}
